package c.x.jy.forkJoin;

import java.util.Random;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class DbUtil {
	
	
	public int getMin(){
	 	Random r =new Random();r.nextInt(10);
		return r.nextInt(10);
		
	}
	
	public int getMax(){
		 Random r =new Random(); //r= r.nextInt(10)+1000000;
		return  r.nextInt(10)+1000000;
		
	}
	
	// @Autowired
	 private MakeArray makeArray =new MakeArray() ;

	public Long sumRecorders(int fromId, int endId) {
		long sum =0;
		String sql =" select order_money from order_info where id>="+fromId+ " and id< "+endId;
		
		try {
			Thread.sleep(20);
		} catch (Exception e) {
			// TODO: handle exception
		}
  //	System.out.println(sql + " qty:" +(endId-fromId) );
		Integer[] result =   makeArray.makeArray(endId-fromId);
		
		for (int i : result) {
			sum +=i;
		}
		return sum;
	}

	
	
}
